<template>
  <div>
    <detail-banner
      :sightName='sightName'
      :bannerImg='bannerImg'
      :gallaryImgs='gallaryImgs'
    ></detail-banner>
    <detail-header></detail-header>
    <div class="content">
        <detail-list :list='contentList'></detail-list>
    </div>
  </div>
</template>

<script>
import axios from 'axios'
import Banner from './components/Banner'
import Header from './components/Header'
import List from './components/List'
export default {
  name: 'detail',
  components: {
    DetailBanner: Banner,
    DetailHeader: Header,
    DetailList: List
  },
  data () {
    return {
      sightName: '',
      bannerImg: '',
      gallaryImgs: [],
      contentList: []
    }
  },
  methods: {
    handerGetBannerData () {
      axios.get('/api/detail.js', {
        params: {
          id: this.$route.params.id
        }
      }).then(this.handerBannerSucc)
    },
    handerBannerSucc (res) {
      res = res.data
      if (res.ret && res.data) {
        const data = res.data
        this.sightName = data.sightName
        this.bannerImg = data.bannerImg
        this.gallaryImgs = data.gallaryImgs
        this.contentList = data.categoryList
      }
    }
  },
  mounted () {
    this.handerGetBannerData()
  }
}
</script>

<style lang="stylus" scoped>
  .content
    height: 50rem
</style>
